<template>
  <div>
    <!-- 面包屑 -->
    <bread></bread>
    <!-- 卡片视图 -->
    <el-card>
      <!-- 权限列表渲染 -->
      <el-table :data="list" border stripe>
        <el-table-column type="index"></el-table-column>
        <el-table-column label="权限名称" prop="authName"></el-table-column>
        <el-table-column label="路径" prop="path"></el-table-column>
        <el-table-column label="权限等级" prop="level">
          <!-- 等级判断 -->
          <template slot-scope="scope">
            <el-tag v-if="scope.row.level === '0'">一级</el-tag>
            <el-tag type="success" v-else-if="scope.row.level === '1'">二级</el-tag>
            <el-tag type="warning" v-else>三级</el-tag>
          </template>
        </el-table-column>
      </el-table>
    </el-card>
  </div>
</template>

<script>
import bread from "../bread";
import API from "../API/Api"
export default {
  name: "",
  data() {
    return {
      list: []
    };
  },
  mounted() {
    this.getList();
  },
  methods: {
    getList() {
      // 获取数据
      API.getList().then(res => {
        if (res.meta.status !== 200) {
          return this.$message.error("获取权限列表失败");
        }
        this.list = res.data;
        console.log(res.data);
      });
    }
  },
  computed: {},
  components: {
    bread
  },
  watch: {},
  getters: {}
};
</script>

<style scoped>
.mbx {
  margin-top: 10px;
  margin-left: 10px;
}
</style>